package com.autoai.animation.demo.customdialog;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Gravity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.autoai.animation.demo.R;

/**
 * @author Wangjw
 * @date 2020-12-22
 * @brief
 */
public class LoginCustomDialog extends Dialog {

    private static LoginCustomDialog INSTANCE;

    public LoginCustomDialog(@NonNull Context context) {
        super(context);
    }

    public LoginCustomDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected LoginCustomDialog(@NonNull Context context, boolean cancelable, @Nullable DialogInterface.OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public static LoginCustomDialog getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = new LoginCustomDialog(context, R.style.CustomDialog);
        }
        return INSTANCE;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lay_login_failed_dialog);
        this.getWindow().setGravity(Gravity.CENTER);
        getWindow().setWindowAnimations(R.style.LoginCustomDialogAnimation);
    }
}
